#ifndef _RECEIVER_H_
#define _RECEIVER_H_

#include "file.h"
#include "folder.h"
#include "xmlerror.h"

class QNetworkReply;

namespace Tubox {

class Receiver : public QObject {
Q_OBJECT
public:
	void answerLogin(const QString& input) throw(XmlError);
	void answerLogoff(const QString& input) throw(XmlError);
	void answerDownload(const QString& input) throw(XmlError);
	void answerUpload(const QString& input) throw(XmlError);
	void answerList(const QString& input) throw(XmlError);
	void answerMove(const QString& input) throw(XmlError);
	void answerDelete(const QString& input) throw(XmlError);
	void answerMkdir(const QString& input) throw(XmlError);
	void answerCopy(const QString& input) throw(XmlError);
	void answerVersion(const QString& input) throw(XmlError);
	
public slots:
	void receive(QNetworkReply * reply) throw(XmlError);

signals:
	void sigLogin(unsigned int status);
	void sigLogoff(unsigned int status);
	void sigDownload(unsigned int status, File& file);
	void sigUpload(unsigned int status, File& file);
	void sigList(unsigned int status, const QString& path, QList<File> files, QList<Folder> folders);
	void sigMove(unsigned int status, const QString& oldPath, const QString& newPath);
	void sigDelete(unsigned int status, QString& fullpath);
	void sigMkdir(unsigned int status, const Folder& folder);
	void sigCopy(unsigned int status, const QString& path, const File& file);
	void sigVersion(unsigned int status, const File& file);

private:
	bool isFile(QNetworkReply *const reply, const QByteArray &data) throw(XmlError);

};



}

#endif
